package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 根据菜品id查询对应的套餐id
     *
     * @param dishIds
     * @return
     */
    //select setmeal_id from setmeal_dish where dish_id in (1,2,3,4)
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    //@AutoFill(value = OperationType.INSERT)
    void insert(List<SetmealDish> setmealDishes);

    Page<SetmealVO> pageQuery (SetmealPageQueryDTO setmealPageQueryDTO);

    @Delete("delete  from setmeal_dish where setmeal_id = #{setemealId}")
    void deleteById(Long setemealId);


    @Select("select * from setmeal_dish where setmeal_id-#{setmealId};")
    List<SetmealDish> getById(Long id);
}